﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace DAL
{
    public abstract class NhanvienDAL:BaseDAL,IBase
    {
        #region IBase Members

        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(object obj, int skip, int take)
        {
            throw new NotImplementedException();
        }

        public object Insert(object obj)
        {
            throw new NotImplementedException();
        }

        public object Update(object obj)
        {
            throw new NotImplementedException();
        }

        public object Delete(Guid id)
        {
            throw new NotImplementedException();
        }

        #endregion
        public DataTable Nhanvien_Select_All()
        {
            return Mapper.QueryForDataTable("Nhanvien_Select_All", null, "Temp");
        }

        public DataTable Nhanvien_Select_All_ForView()
        {
            return Mapper.QueryForDataTable("Nhanvien_Select_All_ForView", null, "Temp");
        }

        public DataTable Nhanvien_Select_All_Show(bool Show)
        {
            return Mapper.QueryForDataTable("Nhanvien_Select_All_Show", Show, "Temp");
        }

        public bool Nhanvien_Insert(DAL.Entities.Nhanvien nv)
        {
            try
            {
                _sqlMapper.Insert("Nhanvien_Insert", nv);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Nhanvien_Update(DAL.Entities.Nhanvien nv)
        {
            try
            {
                _sqlMapper.Update("Nhanvien_Update", nv);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Nhanvien_Delete_Update(Guid Id)
        {
            try
            {
                _sqlMapper.Update("Nhanvien_Delete_Update", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Nhanvien_Update_Delete(Guid Id)
        {
            try
            {
                _sqlMapper.Update("Nhanvien_Update_Delete", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Nhanvien_Delete(Guid Id)
        {
            try
            {
                _sqlMapper.Delete("Nhanvien_Delete", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }


        public DataTable Nhanvien_Select_By_Ma(string Ma)
        {
            return Mapper.QueryForDataTable("Nhanvien_Select_By_Ma", Ma, "Temp");
        }

        public DataTable Nhanvien_Select_By_Id_Nhomnguoidung(Guid Id_Nhomnguoidung)
        {
            return Mapper.QueryForDataTable("Nhanvien_Select_By_Id_Nhomnguoidung", Id_Nhomnguoidung, "Temp");
        }

        public bool Nhanvien_Update_Pass(DAL.Entities.Nhanvien nv)
        {
            try
            {
                _sqlMapper.Update("Nhanvien_Update_Pass", nv);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

    }
}
